package net.projects.pro1_weather;

import java.io.*;
import java.net.Socket;

public class NetClient {
    public static void main(String[] args) throws IOException {
        // 创建socket对象
        Socket socket = new Socket("127.0.0.1", 65201);

        OutputStream os = socket.getOutputStream();
        os.write("hengyang".getBytes());
        socket.shutdownOutput();
        // 读回写数据
        BufferedReader bfd = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String line;
        while ((line = bfd.readLine()) != null) {
            System.out.println(line);
        }
        socket.close();
    }
}
